package us.kg.kotoriforest.aop.proxy.impl;

import org.springframework.stereotype.Component;
import us.kg.kotoriforest.aop.proxy.Calculator;

/**
 * @author Kotori rotroutine@163.com
 * @since 2025/1/6
 */
@Component // 将该类对象放入IOC容器中管理
public class CalculatorImpl implements Calculator {
    @Override
    public int add(int i, int j) {

        int result = i + j;

        System.out.println("方法内部 result = " + result);

        return result;
    }

    @Override
    public int sub(int i, int j) {

        int result = i - j;

        System.out.println("方法内部 result = " + result);

        return result;
    }

    @Override
    public int mul(int i, int j) {

        int result = i * j;

        System.out.println("方法内部 result = " + result);

        return result;
    }

    @Override
    public int div(int i, int j) {

        int result = i / j;

        System.out.println("方法内部 result = " + result);

        return result;
    }

    public void exception() {
        throw new RuntimeException("测试");
    }
}
